package com.renting.modules.upyun.config;

import main.java.com.UpYun;
import main.java.com.upyun.FormUploader;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class UpYunConfig {

    @Value("${up_bucket_name}")
    private String up_bucket_name;

    @Value("${up_user_name}")
    private String up_user_name;

    @Value("${up_password}")
    private String up_password;

    @Value("${up_api_key}")
    private String up_api_key;

    @Bean
    public UpYun getUpYun() {
        UpYun upYun = new UpYun(up_bucket_name, up_user_name, up_password);
        return upYun;
    }

    @Bean
    public FormUploader getFormUploader() {
        FormUploader uploader = new FormUploader(up_bucket_name, up_api_key, null);
        return uploader;
    }
}
